<%--
    Document   : listOfWH
    Created on : May 19, 2013, 6:59:34 PM
    Author     : Vitalii D.
--%>

<%@page import="java.util.List"%>
<%@page import="com.charlie.beans.Users"%>
<%@page import="com.charlie.beans.Warehouse"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%  
    //no caching
    response.setHeader("Cache-Control","no-cache");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader ("Expires", 0);
%>

<%@include file="/header.jsp"%>

<div class="left_side"> 
    <jsp:include page="/blocks/conditionalLeftBar.jsp" />  
</div>

<div class="right_side">
    <h2 class="content_title" >View warehouses</h2>
    <div class="white_block">
        <%
            List<Warehouse> warehouse_list = (List<Warehouse>) request.getAttribute("warehouse_list");
            if (warehouse_list != null) {
        %>
        <h2 style="text-align: center;"> Select the warehouse you want to edit </h2>
        <table class="typycal_table">
            <thead>
                <tr class="underLinedRow"> 
                    <th> id </th>
                    <th> name</th>
                    <th> shipment rate</th>
                    <th> shipment duration </th>
                </tr>
            </thead>
            <tbody>
                <%
                    for (Warehouse wh : warehouse_list) {%>
                <tr>
                    <td>
                        <%= wh.getWarehouseId()%>
                    </td>
                    <td>
                        <%= wh.getName()%>
                    </td>
                    <td>
                        <%= wh.getShipmentRate()%>
                    </td>
                    <td>
                        <%= wh.getShipmentDuration()%>
                    </td> 
                    <td>
                        <form method="post" action="EditWH?whId=<%= wh.getWarehouseId()%>">
                            <input type="submit" value="Edit" name="edit" />
                        </form>
                    </td>
                </tr>
                <%}
                    } else {
                        out.print("<h1>No warehouses</h1>");
                    }
                %>
            </tbody>
        </table>
    </div>
</div>

<jsp:include page="/footer.jsp" />
